import {Name} from "./Name"

export class Country {
  id = -1
  parentId = -1
  latitude = ""
  longitude = ""
  layer = -1
  createdTime = new Date()
  dataVersion = 0
  lastUpdatedTime = new Date()
  guid = ""
  name = new Name()

  constructor (id = -1, parentId = -1, latitude = "", longitude = "", layer = -1, createdTime = new Date(), dataVersion = 0, lastUpdatedTime = new Date(), guid = "", name = new Name()){
      this.id = id
      this.parentId = id,
      this.latitude = latitude
      this.longitude = longitude
      this.layer = layer
      this.createdTime = createdTime
      this.dataVersion = dataVersion
      this.lastUpdatedTime = lastUpdatedTime
      this.guid = guid
      this.name = name
  }

  static isValid(obj){
      let retv = true

      retv &= obj.id != null
      retv &= obj.parentId != null
      retv &= obj.latitude != null
      retv &= obj.longitude != null
      retv &= obj.layer != null
      retv &= obj.createdTime != null
      retv &= obj.dataVersion != null
      retv &= obj.lastUpdatedTime != null
      retv &= obj.guid != null

      return retv
  }
}
